SPB Git forge

spb/websensor

Public
33commits 1branches 0releases
3.4 MBsize
maindefault branch
10 days agolast push
TypeScript 55.4% Python 43.2% SQL 1.2%
772 B · 16 lines tsx
Raw Blame History
1import { notFound } from "next/navigation";2import type { ReactNode } from "react";3import { api } from "@/lib/api";4import { CATEGORIES, FEED_CHANNELS } from "@websensor/core/client";56/**7 * Existence check outside the `loading.tsx` boundary so unknown category channels return a real 404 instead of a8 * 200 shell followed by the not-found UI (the page's own call is deduplicated by fetch memoization).9 */10export default async function CategoryLayout({ params, children }: { params: Promise<{ channel: string }>; children: ReactNode }) {11  const { channel } = await params;12  const ch = channel.toLowerCase();13  if (!FEED_CHANNELS[ch] && !(CATEGORIES as readonly string[]).includes(ch) && !(await api.categoryDesk(ch))?.recent.length) notFound();14  return children;15}16